<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>欢迎登陆</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
    <style>
        #locate{
            position : absolute;
            width: 100%;
            height: 100%;
            background-image: url("/images/concert.jpg");
            background-repeat: no-repeat;
            background-size: cover;
            /*object-fit: contain;*/

        }
        .layui-card{
            width: 400px;
            height: max-content;
            margin: auto;
            margin-top: 15%;
            opacity: 90%;
        }
    </style>
</head>
<body>

<div id="locate">
    <div class="layui-card">
        <div class="layui-card-header">登录——演唱会票务管理系统</div>
        <div class="layui-card-body">
            <form class="layui-form" action="" id="form1"> <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
                <div class="layui-form-item">
                    <label class="layui-form-label">账号：</label>
                    <div class="layui-input-block">
                        <input type="text" name="account" placeholder="账号" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">密码：</label>
                    <div class="layui-input-block">
                        <input type="password" name="password" placeholder="密码" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="formDemo">登录</button>
                        <button type="reset" class="layui-btn layui-btn-primary">注册</button>
                    </div>
                </div>
                <!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
            </form>
        </div>
    </div>
</div>




<script src="/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块  ctrl+ shift + 数字
        // 20 分钟修改这个地方的代码


    }).use(['index','jquery','layer','form'], function () {
        var table = layui.table;
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;

        form.on('submit(formDemo)', function(data){

            $.ajax({
                type: "POST",
                url: "/loginchecker",
                data: data.field,
                success: function (data) {
                    console.log(data)
                    if(data.success == true){
                        layer.msg("登录成功")
                        window.location.href = 'index';
                    }
                    else {
                        layer.msg(data.msg)
                    }
                },
                dataType: "json"
            });

            return false;
        });

    });
</script>

</body>
</html>


